﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;
using Huirui.Cavan.Domain.MainBoundedContext.Resources;

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    public class EmployeeValidator : AbstractValidator<Employee>
    {
        public EmployeeValidator()
        {
            RuleFor(d => d.Id).NotEmpty().WithMessage(Messages.Validate_IdNotEmpty);
            RuleFor(d => d.Name).Length(1,10).WithMessage(Messages.Validate_NameNotEmpty);
            RuleFor(d => d.Corporation).NotNull().WithMessage(Messages.Validate_CorporationNotNull);
            RuleFor(d => d.Mobile).NotEmpty().WithMessage(Messages.Validate_TelephoneMobileIsInvalid);
            RuleFor(d => d.Job.Id).GreaterThan(0).WithMessage(Messages.Validate_JobNotNull);
        }
    }
}
